<table cellspacing='0' cellpadding='0'>
  <tr>
    <td valign='top' id='LeftMenu'>
      <div class="sidebar">
        <span>
<%= calendar( :year => @year, :month => @month, :id=>(@space.nil? ? 0: @space.id)) do |d|
  cell_text = "#{d.mday}<br />" 
  cell_attrs = {:class => 'day'}
  if @weblogs_by_day[d]
    cell_text = link_to(d.mday, :action => 'list', :year => @year, :month => @month, :day => d.mday)
    cell_attrs[:class] = 'specialDay'
  end
  [cell_text, cell_attrs]
end
%>
        </span>
      </div>
      <!-- The Updates -->
      <span>
        <div class="sidebar">
          <div class="sidebarHeader"> 更新 <%= link_to( image_tag( "xml.gif", :border=>0), :controller=>"page", :action=>"feed") %></div> 
	  <table class="sidebarContent" cellpadding="0" cellspacing="0" border="0">
            <% @recent_updated.each do |page| %>
	    <tr valign="top">
              <td>
                <%= link_to truncate(page.title), :controller => "page", :action => "show", :id => page.id %>
                <br/>
                <span class="smalltext">
                  <span><%= url_for_user page.user %></span>(<span><%= page.log_date %></span>)
                </span>
              </td>
            </tr>
            <% end %>
          </table>
        </div>
      </span>

      <!-- The Comments Updates -->
      <span>
        <div class="sidebar">
          <div class="sidebarHeader"> 最新评论 </div> 
	  <table class="sidebarContent" cellpadding="0" cellspacing="0" border="0">
            <% @recent_comment_updated.each do |comment| %>
	    <tr valign="top">
              <td>
                <%= link_to (truncate(comment.comment)), :controller => "page", :action => "show", :id => comment.page_id %>
                <br/>
                <span class="smalltext">
                  <span><%= url_for_user comment.user %></span>(<span><%= comment.created_at.to_date %></span>)
                </span>
              </td>
            </tr>
            <% end %>
          </table>
        </div>
      </span>

      <!-- The Spaces -->
      <span>
        <div class="sidebar">
          <div class="sidebarHeader">空间</div>
          <table class="sidebarContent">
  <% @spaces.each do |space| %> 
            <tr>
              <td>
  <%= link_to "#{space.name}",
                  :controller => "space",
                  :action     => "show",
                  :id         => space.id %>
  <%= link_to( image_tag( "tinyXML.jpg", :border => 0),
             :controller=> "page", :action => 'feed', :id => space) %>
              </td>
            </tr>
  <% end %>
          </table>
        </div>
      </span>

      <!-- space action -->
      <% if @space %>
      <span>
        <div class="sidebar">
          <div class="sidebarHeader"> 动作 </div> 
<table class="sidebarContent" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top">
    <td>
      <%= link_to '浏览空间', :controller=>'page', :action=>'list', :id=>@space %><br/>
      <% if can_have_action %>
      <%= link_to '添加wiki页', :controller=>'page', :action=>'new', :space_id=>@space.id %><br/>
        <%= link_to '添加blog页', :controller=>'page', :action=>'new', :space_id=>@space.id, :type=>'Weblog' %>
      <% end %>
    </td>
  </tr>
</table>
        </div>
      </span>
      <% end %>

    </td> 
    <td valign='top' id='ContentBody'> 
      <span> 
        <span>
          <% prev_date = nil
          @weblogs.each do |blog| %>
          <%=date_title( blog, prev_date)%>
          <% prev_date = blog.log_date%>
          <div class="EntryBox">
            <div class="EntryTitle">
              <%= link_to h(blog.title), :controller=>"page", :action=>"show", :id=>blog %>
            </div> 
            <div class="EntryContent"><%= markup(blog, blog.content) %>
            </div>
            <div class="EntryDesc" style="text-align: right;">
              <span><%= time_to_str blog.updated_at %></span> | <!--<img src="resources/wipo/user" align="absmiddle">-->
              <strong><span><%= url_for_user blog.user %></span></strong> |
              <%= image_tag "comment.gif", :align=>"absmiddle" %>
              <span><%= link_to_remote "共#{blog.comments.size}条留言", 
                :url=>{ :controller=> "page", :action=> "comments", :id=>blog.id} %></span>
            </div>
            <div class="EntryContent" id="comments_<%=blog.id%>" style="display:none"></div>
          </div>
          <% end %>
        </span>
      </span>
    </td>
  </tr>
</table>


